home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
C
/
Games
/
SpriteFight 2002 v2.0a1
/
SpriteError.c
< prev
next >
Wrap
Text File
|
1996-05-01
|
3KB
|
134 lines
/* SpriteError.c by Stefan C. Sinclair Copyright © 1995-1996 All rights rserved */
#include "SpriteError.h"
extern Boolean gSpeech;
static Boolean doneTalking;
/********** DoMessage ********************/
void DoMessage( short message)
{
Str255 messageString;
short ok;
OSErr err;
GetIndString(messageString, kMessageStringListID, message);
if (messageString[0] == 0)
BlockMove(kSeriousDamageString, messageString, sizeof(kSeriousDamageString));
ParamText(messageString, "\p","\p", "\p");
if(gSpeech)
{
ErrorSound(nil); // Shut off system sounds
err = SpeakString(messageString);
}
ok = NoteAlert(kDoErrorAlertID, NULL);
// Shut up!
if(gSpeech)
{
err = SpeakString("\p");
}
}
/********** DoError ********************/
void DoError( short error, Boolean fatal)
{
Str255 messageString;
GetIndString(messageString, kDoErrorStringListResID, error);
if (messageString[0] == 0)
BlockMove(kSeriousDamageString, messageString, sizeof(kSeriousDamageString));
ParamText(messageString, "\p","\p", "\p");
if(!fatal)
CautionAlert(kDoErrorAlertID, NULL);
else
{
StopAlert(kDoErrorAlertID, NULL);
ExitToShell();
}
}
Boolean ChoiceAlert(short choice)
{
Str255 messageString;
Boolean hitOK = FALSE;
GetIndString(messageString, kChoiceStringListResID, choice);
if (messageString[0] == 0)
BlockMove(kSeriousDamageString, messageString, sizeof(kSeriousDamageString));
ParamText(messageString, "\p","\p", "\p");
if(Alert(kChoiceAlertResID, NULL) == kItemNumber2)
hitOK = TRUE;
return hitOK;
}
void CantFindResource(void)
{
OSErr err;
err = ResError();
if (err == noErr)
err = resNotFound;
ErrorAlert(err, kCantFindResourceStringIndex);
ExitToShell();
}
void ErrorAlert(OSErr err,short errorStringIndex)
{
Str255 messageString, errorString;
// make sure we don't know what this error is...
if (errorStringIndex == kUnknownErrorStringIndex)
{
switch (err)
{
case memFullErr:
errorStringIndex = kNotEnoughMemoryStringIndex;
break;
case resNotFound:
errorStringIndex = kCantFindResourceStringIndex;
break;
}
}
GetIndString(messageString, kErrorStringListResID, errorStringIndex);
if (messageString[0] == 0)
BlockMove(kSeriousDamageString, messageString, sizeof(kSeriousDamageString));
NumToString(err, errorString);
ParamText(messageString, errorString, "\p", "\p");
(void)StopAlert(kErrorAlertResID, NULL);
}
void CantRunOnThisMachine(short whyNot, Boolean fatal)
{
Str255 messageString;
short errorStringIndex;
GetIndString(messageString, kErrorStringListResID, whyNot);
if (messageString[0] == 0)
BlockMove(kSeriousDamageString, messageString, sizeof(kSeriousDamageString));
ParamText(messageString, "\p","\p", "\p");
if(fatal)
{
StopAlert(kCantRunAlertResID, NULL);
ExitToShell();
}
else
CautionAlert(kCantRunAlertResID, NULL);
}